package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.${capitalize};
import cn.wolfcode.wolf2w.query.${capitalize}QueryObject;
import cn.wolfcode.wolf2w.service.I${capitalize}Service;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("${uncapitalize}s")
public class ${capitalize}Controller {

    @Autowired
    private I${capitalize}Service ${uncapitalize}Service;

    // 分页查询
    @GetMapping("/query")
    public Object query(${capitalize}QueryObject qo) {
        Page<${capitalize}> ${uncapitalize}s = ${uncapitalize}Service.query(qo);
        return JsonResult.success(${uncapitalize}s);
    }

    // 查询全部
    @GetMapping("/list")
    public Object list() {
        List<${capitalize}> list = ${uncapitalize}Service.list();
        return JsonResult.success(list);
    }

}
